package com.swf.seed.beanwraper;

import java.beans.PropertyDescriptor;
import java.util.Enumeration;

import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;

public class TestHelloWorld {
	public static void main(String[] args)throws IllegalAccessException,ClassNotFoundException, InstantiationException{ 
		  HelloWorld helloWorld = new HelloWorld();
		  BeanWrapper bw = new BeanWrapperImpl(helloWorld); 
		  bw.setPropertyValue("sex","man"); 
		  bw.setPropertyValue("age",1); 
		  bw.setPropertyValue("name","Jack"); 
		  helloWorld.say();
		  System.out.println(bw.getPropertyValue("name")+" "+bw.getPropertyValue("age")); 
		  PropertyDescriptor[] pd = bw.getPropertyDescriptors();
		  for (PropertyDescriptor p:pd){
			  Enumeration<String> attributeNames = p.attributeNames();
			  while (attributeNames.hasMoreElements()){
				  System.out.println(attributeNames.nextElement());
			  }
		  }
		} 

}
